package io.SerializableDemo;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

public class ReadSerializable {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        ObjectInputStream objectInputStream;
        objectInputStream = new ObjectInputStream(new FileInputStream("SerializableID.txt"));
        Teacher teacher1 = (Teacher)objectInputStream.readObject();
        Teacher teacher2 = (Teacher)objectInputStream.readObject();
        Person person = (Person)objectInputStream.readObject();
        System.out.println(teacher1.getStudent() == teacher2.getStudent());
        System.out.println(teacher1.getStudent() == person);
        objectInputStream.close();
    }
}
